Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

131
Vistas
Stripe /v1/payment_intents/:id/confirm returns HTTP 400 “Received unknown parameters” (Stripe Elements and React)

I am using @stripe/react-stripe-js and @stripe/stripe-js in my project to handle card payments.

I have set up a webhook API and a payment intent API. These works great! The problem occurs when I call stripe.confirmCardPayment()

When I try to submit my payment I get a HTTP 400 error from the Stripe endpoint POST /v1/payment_intents/:id/confirm. (https://api.stripe.com/v1/payment_intents/pi_abc/confirm)

My code is based on Stripe example code, see below:

const handleSubmit = async event => {
    event.preventDefault();

    if (!stripe || !elements) {
      // Stripe.js has not loaded yet. Make sure to disable form submission until Stripe.js has loaded.
      return;
    }

    const payload = await stripe.createPaymentMethod({
      type: "card",
      card: elements.getElement(CardNumberElement)
    });
    console.log("[PaymentMethod]", payload);
    const paymentIntentURI = 'https://api.mydomain.com/v1/create_payment_intent'
    const data = {items:'product_123'}

    const response = await fetch(paymentIntentURI,{
      method: 'POST', 
      mode: 'cors', 
      cache: 'no-cache', 
      credentials: 'same-origin', 
      headers: { 'Content-Type': 'application/json' },
      redirect: 'follow', 
      referrerPolicy: 'no-referrer', 
      body: JSON.stringify(data) // body data type must match "Content-Type" header
    });
    const responseJSON = await response.json();
    const clientSecret = responseJSON?.clientSecret ?? '';
    payWithCard({stripe, card:payload.paymentMethod.card, clientSecret})
  };

  const payWithCard = ({stripe, card, clientSecret}) => {
    //loading(true);
    stripe.confirmCardPayment(clientSecret, {
      payment_method: {
        card: card
      }
    }) 
    .then(function(result) {
      if (result.error) {
        // Show error to your customer
        console.error(result.error.message) //<--- THIS LINE LOGS THE ERROR MESSAGE
        showError(result.error.message);
      } else {
        // The payment succeeded!
        orderComplete(result.paymentIntent.id);
      }
    });
  };

The log shows error:

Received unknown parameters: brand, country, funding, networks, three_d_secure_usage

package.json

"@stripe/react-stripe-js": "^1.4.1",
"@stripe/stripe-js": "^1.16.0",

Everything seems correct in the Stripe dashboard up to stripe.confirmCardPayment().

POST /v1/payment_intents/:id/confirm rejects some key-value pairs in the payload.

What am I doing wrong? Kind regards /K

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

I should NOT have fetched the card from the result of stripe.createPaymentMethod() (payload.paymentMethod.card) - by doing so I seem to have got hold the wrong card Object.

Fetching the card from elements.getElement(CardNumberElement) seems to fetch the correct card Object!

This actually simplifies the code a great deal :D

const payWithCard = () => {
    const card = elements.getElement(CardNumberElement)
    console.log('payWithCard', card)
    stripe.confirmCardPayment(clientSecret, {
      receipt_email: email,
      payment_method: {
        card: card,
        ...
about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda